-- @owner: cloudsbreak
-- @date: 2025/06/30
-- @testpoint:subtype类型为已经存在的record类型，匿名块中用动态SQL调用
--setup
@conn  PrimaryDbAmode;
create extension gms_output;
select gms_output.enable();
--step1:
CREATE OR REPLACE PACKAGE pkg_1154927 AUTHID DEFINER AS

TYPE rec_src IS RECORD (n1 NUMBER, n2 NUMBER);
subtype rec is rec_src;
PROCEDURE p (x OUT rec, y NUMBER, z NUMBER);
END pkg_1154927;
/
CREATE OR REPLACE PACKAGE BODY pkg_1154927 AS

PROCEDURE p (x OUT rec, y NUMBER, z NUMBER) AS
BEGIN
x.n1 := y;
x.n2 := z;
END p;
END pkg_1154927;
/

DECLARE
r pkg_1154927.rec;
dyn_str VARCHAR2(3000);
BEGIN
dyn_str := 'BEGIN pkg_1154927.p(:x, 6, 8); END;';

EXECUTE IMMEDIATE dyn_str USING OUT r;

raise info 'INFO:r.n1 = %' , r.n1;
raise info 'INFO:r.n2 = %' , r.n2;
END;
/

--teardown:环境清理
drop extension gms_output;
drop PACKAGE pkg_1154927;
